package com.shujia

import java.text.SimpleDateFormat
import java.util.Date

object test {
  def main(args: Array[String]): Unit = {

    val sf = new SimpleDateFormat("yyyyMMddHHmmss")

    val dataStr = "20180503171159"

    //将字符串转换成时间
    val date = sf.parse(dataStr)

    println(date)

    //将时间转换成字符串
    val s = sf.format(new Date())

    println(s)

  }
}
